<?php 
/* SVN FILE: $Id$ */
/* Product Test cases generated on: 2009-11-10 10:58:13 : 1257818293*/
App::import('Model', 'Cart');
#require_once('product_fixture.php');
class CartTestCase extends CakeTestCase {
	var $Cart = null;
	var $fixtures = array('app.product');

	function startTest() {
		$this->Cart =& ClassRegistry::init('Cart');
		$f = new ProductFixture;
		#debug($f->getRecords());
		foreach( $f->getRecords() as $key => $value ){
			$this->{$key} = $value;
		}
	}

	function testCartInstance() {
		$this->assertTrue(is_a($this->Cart, 'Cart'));
	}
	function testAddUniqueProducts(){
		#debug($this->version_control_book);
		#debug($this->automation_book);
		$this->Cart->add_product($this->version_control_book);
		$this->Cart->add_product($this->automation_book);
		$this->assertEqual($this->version_control_book['price'] + $this->automation_book['price'],$this->Cart->total_price);
		$this->assertEqual(count($this->Cart->items()),2);
		#debug($this->Cart);
	}
	function testAddDuplicateProducts(){

		$this->Cart->add_product($this->version_control_book);
		$this->Cart->add_product($this->version_control_book);
		$this->assertEqual($this->version_control_book['price'] * 2,$this->Cart->total_price);
		$this->assertEqual(count($this->Cart->items()),1);
		#debug($this->Cart);
	}
}
?>